<template>
    <app-dialog v-model="show" width="576px" title="请下载内核后重试" @open="handleOpen">

        <div class="download_dialog">
            <div>此环境（{{ state.dialogData.name }}）需使用“{{ state.dialogData.environment_data.base.browser.type }}
                {{ state.dialogData.environment_data.base.browser.version }}”内核才可打开，您电脑上暂无该内核文件，是否现在下载？</div>
        </div>

        <template #footer>
            <app-button @click="handleClose">暂不打开</app-button>
            <app-button class="app-button-ptn" style="margin-left: 8px;" @click="clickSubmit()">立即下载</app-button>
        </template>
    </app-dialog>
</template>

<script setup>
import { http } from '@/utils/http'
import { ElMessage } from 'element-plus'
import { downloadCore } from '@/utils/downloadCore'
const show = defineModel({ type: Boolean })
const emits = defineEmits(['change'])
const { store, state } = inject('storejs')
const handleOpen = () => {
}

const handleClose = () => {
    show.value = false
    state.dialogData = {}
}

const clickSubmit = () => {
    let body = JSON.parse(JSON.stringify(state.dialogData.environment_data))
    let a = {
        type: body.base.browser.type,
        version: body.base.browser.version
    }
    downloadCore(a)
    show.value = false

}
</script>

<style lang="scss" scoped>
.download_dialog {
    padding: 24px;
    font-size: 16px;


}
</style>